package com.qzl.feiq.strategy.impl;

import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import com.qzl.feiq.annotation.ReceiveType;
import com.qzl.feiq.config.StaticConfig;
import com.qzl.feiq.message.Message;
import com.qzl.feiq.strategy.Receive;

/**
 * 收到消息确认回复
 */
@Slf4j
@ReceiveType(command = StaticConfig.IPMSG_SENDMSG|StaticConfig.IPMSG_SENDCHECKOPT)
public class IpmsgSendMsgImpl implements Receive {
    /**
     * 回复消息
     *
     * @param channel
     */
    @Override
    public void receiveMsg(Channel channel,Message oldMessage) {
        log.info("收到消息确认回复");
        Message message = new Message(oldMessage.getFromUserIp(), StaticConfig.IPMSG_RECVMSG);
        message.setMsg(oldMessage.getPacketNo()+"");
        channel.writeAndFlush(message);
    }
}
